<template>
  <div class="view" id="login_footer">
    <el-form class="first-el-form" :model="loginForm" label-width="70px" :rules="loginRules" ref="loginForm">
      <el-form-item label="用户名" prop="username">
        <el-input v-model="loginForm.username"></el-input>
      </el-form-item>
    </el-form>
    <el-form label-width="70px">
      <el-form-item label="密码" prop="password">
        <el-input v-model="loginForm.password" show-password></el-input>
      </el-form-item>
    </el-form>
    <div style="width: 300px;height: 40px" class="div-code-position">
      <el-form class="el-form-code" label-width="70px">
        <el-form-item label="验证码" prop="code">
          <el-input class="validation_code" v-model="loginForm.code"></el-input>
        </el-form-item>
        <img class="validation_code_img" src="@/assets/image/bmob.png">
      </el-form>
    </div>
    <el-button class="login_btn_action" type="primary" @click="loginAction">注册</el-button>


  </div>
</template>

<script>
  export default {
    name: "Registered",
    data() {
      return {
        //这是登录表单的数据绑定对象
        loginForm: {
          username: 'admin',
          password: '312',
          code: 'bmob'
        },
        //这是表单的验证规则对象
        loginRules: {
          username: [{required: true, message: '请输入邮箱地址', trigger: 'blur'},
            {type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change']}
          ],
          password: [{required: true, message: '请输入活动名称', trigger: 'blur'},
            {min: 8, max: 16, message: '长度在 6 到 16 个字符', trigger: 'blur'}],
          code: [{required: true, message: '验证码不能为空', trigger: 'blur'},
            {min: 4, max: 6, message: '长度在 4 到 6 个字符', trigger: 'blur'}]
        }
      };

    },
    methods: {
      loginAction() {
        this.$router.push("/home")
      }
    }

  }
</script>

<style scoped>
  .first-el-form {
    margin-top: 60px;
  }

  .el-form {

    margin-right: 30px;
  }

  .validation_code {
    float: right;
    /*padding: 5px 40px ;*/
    /*margin-right: 100px;*/
  }

  .div-code-position {
    position: relative;
  }

  .el-form-code {
    /*position: relative;*/
    width: 200px;

  }

  .validation_code_img {
    position: absolute;
    top: 10px;
    right: 15px;
    float: right;
    width: 80px;
  }

  .login_btn_action {
    float: right;
    padding: 10px 97px;
    margin: 23px 26px;
    /*margin: 20px 40px;*/
  }


</style>
